﻿Imports System.Globalization
Imports System.IO
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Markup
Imports System.Windows.Media

Public Class WindowCloseButton
    Inherits WindowButton

    Private _backgroundDefaultValue As Brush

    Public Overrides ReadOnly Property BackgroundDefaultValue() As Brush
        Get
            Return _backgroundDefaultValue
        End Get
    End Property

    Public Sub New()
        Me.Width = 43

        ' open resource where in XAML are defined some required stuff such as icons and colors
        'Dim resourceStream As Stream = Application.GetResourceStream(New Uri("pack://application:,,,/PT_CustomWindow;component/ButtonIcons.xaml")).Stream
        'Dim resourceDictionary As ResourceDictionary = DirectCast(XamlReader.Load(resourceStream), ResourceDictionary)

        '
        ' Background
        Me.Background = DirectCast(Me.Resources("RedButtonBackground"), Brush)
        _backgroundDefaultValue = DirectCast(Me.Resources("RedButtonBackground"), Brush)

        '
        ' Foreground (represents a backgroundcolor when Mouse is over)
        Me.Foreground = DirectCast(Me.Resources("RedButtonMouseOverBackground"), Brush)

        ' set icon
        Me.Content = Me.Resources("WindowButtonCloseIcon")

        ' radius
        Me.CornerRadius = New CornerRadius(0, 0, 3, 0)
    End Sub

End Class
